'''
* This is the projet for Brtc LlmOps Platform
* @Author Leon-liao <liaosiliang@alltman.com>
* @Description //TODO 
* @File: 4_study_base_tool.py
* @Time: 2025/10/15
* @All Rights Reserve By Brtc
'''
from typing import Type, Any

from langchain_core.tools import BaseTool
from pydantic import BaseModel, Field


class CaculatorInput(BaseModel):
    a: int = Field(description="第一个参数")
    b: int = Field(description="第二个参数")

class MultiplyTool(BaseTool):
    """乘法工具"""
    name:str = "multiply_tools"
    description:str ="将传递的两个参数相乘"
    args_schema:Type[BaseModel] = CaculatorInput

    def _run(self, a:int, b:int) -> Any:
        return a*b
calculator = MultiplyTool()
print("函数名称", calculator.name)
print("函数描述", calculator.description)
print("函数参数", calculator.args)
print("是否直接返回", calculator.return_direct)
print(calculator.invoke({"a":10, "b":5}))
